]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Handle screencast errors properly
authorJonas Dreßler <verdre@v0yd.nl>
Wed, 26 Apr 2023 10:34:17 +0000 (12:34 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Wed, 26 Apr 2023 11:36:26 +0000 (13:36 +0200)
Send a notification and remove the screencast inidicator when we hear about
a screencast error from the dbus service.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2752>

js/ui/screenshot.js

index 9acc07494642e249e9580d556e048536a1ba52d0..d50a4f0460ad914170dfc0d2bb58139d5edaf47b 100644 (file)
@@ -1037,6 +1037,9 @@ var ScreenshotUI = GObject.registerClass({
                 this._castButton.visible = this._screencastSupported;
             });
 
+        this._screencastProxy.connectSignal('Error',
+            () => this._screencastFailed());
+
         this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' });
 
         // The full-screen screenshot has a separate container so that we can
@@ -1913,6 +1916,18 @@ var ScreenshotUI = GObject.registerClass({
             return;
         }
 
+        // Translators: notification title.
+        this._showNotification(_('Screencast recorded'));
+    }
+
+    _screencastFailed() {
+        this._setScreencastInProgress(false);
+
+        // Translators: notification title.
+        this._showNotification(_('Screencast ended unexpectedly'));
+    }
+
+    _showNotification(title) {
         // Show a notification.
         const file = Gio.file_new_for_path(this._screencastPath);
 
@@ -1923,8 +1938,7 @@ var ScreenshotUI = GObject.registerClass({
         );
         const notification = new MessageTray.Notification(
             source,
-            // Translators: notification title.
-            _('Screencast recorded'),
+            title,
             // Translators: notification body when a screencast was recorded.
             _('Click here to view the video.')
         );